<?php
namespace app\serverfile\service\file;

use \app\manage\service\ApiBase;
use think\Validate;

class ApiFile extends ApiBase
{
    protected $fileLogic = 'app\serverfile\logic\File';
    protected $fileValidate = 'app\serverfile\validate\File';

    //上传文件
    public function upload()
    {
        $data = $this->receiveData(['type'=>'']);
        $sendData['query'] = json_encode([
            ["path"=>"manage/controller/Index/upload","param"=>$data]
        ]);
        return ApiBase::sendDataOne(config('proxy_queue_url'), $sendData);
    }

    public function fileDelete()
    {
        $data = $this->receiveData(['id'=>'']);
        return $this->oneStepRun($data, 'serverfile/file/ApiFile/fileDelete', 'fileDelete', '1', $this->fileValidate, $this->fileLogic);
    }

    public function fileGain()
    {
        $data = $this->receiveData(['id'=>'']);
        return $this->oneStepRun($data, 'serverfile/file/ApiFile/fileGain', 'fileGain', '1', $this->fileValidate, $this->fileLogic);
    }
}